<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let arr = ['apple', 'banana', 'orange', 'tomato'];
        console.log(Object.keys(arr));
        console.log(Object.values(arr));
        // arr.keys() 索引
        // arr.entries() 数组某一项

        // for (let val of arr) {
        //     console.log(val);
        // };

        // for (let index of arr.keys()) {
        //     console.log(index);
        // };

        // for (let index of arr.entries()) {
        //     console.log(index);
        // };

        for (let [key, vak] of arr.entries()) {
            console.log(key, vak);
        };
    </script>
</body>

</html>